<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>

    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>

    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
<input class="span12" name="dd" id="dd" type="text"  value="" style="font-size: 18px;margin-top: 4%;">
<button class="btn"  onclick="fun()" style="background-color: transparent !important;margin-top: -0.5%;border: 1px solid #626262;">抽取</button>
<button class="btn"  onclick="window.hidden()" style="background-color: transparent !important;margin-top: -0.5%;border: 1px solid #626262;">hehe</button>
<div class="pp" style="border: 1px solid #626262;width: 280px; height: 250px; margin-top: 10px"></div>
</body>
<script>
    function fun() {
        var string = document.getElementById("dd").value;//原始数据
        var array = string.split("，"); //转化为数组
        $(".pp").empty();
        var l=array.length;
        for(i=0;i<l;i++){
            n=Math.floor(Math.random() * (array.length));
            $(".pp").append(array[n]+",");//随机选取
            array.splice(n,1)
        }
    }
    function hidden(){
        document.getElementById("dd").value="";
        document.getElementById("pp").innerHTML ="";
    }

</script>
</html>